import {//商品卡片组件
    Button,
    Col,
    Upload,
    Input,
    Drawer,
    Space,
    Form,
    Row,
    Select,
    Modal,
    InputNumber,
    Checkbox,
  } from 'antd';
  import React, { useState, useEffect, useRef } from 'react';
  import {
    DoubleRightOutlined,
    PlusOutlined
  } from '@ant-design/icons';
  import { postOld, getSchoolList } from '@/api/index';
  import './index.css';
  import { baseUrl } from '@/assets/baseUrl';
  import knife from './../../../../../assets/image/knife.png'
  const getBase64 = (file) =>
    new Promise((resolve, reject) => {
      const reader = new FileReader();
      reader.readAsDataURL(file);
  
      reader.onload = () => resolve(reader.result);
  
      reader.onerror = (error) => reject(error);
    });
  const { Option } = Select;
  const BaseUrl = baseUrl()
  export default function CommodityCard(props) {
    const [activeTab, setActiveTab] = useState(false);//详情的弹窗
    const [params, setParams] = useState(props.info);
    useEffect(() => {
      console.log(params);
    }, [params]);

    return (
    <div className='content' onClick={()=>{props.openModal(true);props.itemData(params)}} style={{backgroundColor:params.mineGood?'rgb(250 127 57)':'#fff'}}>
      <div className='ImgSize'> <img  src={BaseUrl+params.mainPicture} alt="" /></div>
      <div style={{padding:'6px 6px'}}>
       <div className='lineOne'>
        <span className='titleSize'> 
        {/* <span><img className='icon' src={knife} alt="" /></span> */}
        {params.goodName}</span>
        <span className='schoolSize' style={{color:params.mineGood?'white':'#DE868F'}}>{params.campus}</span>
       </div>
       <div className='lineTow'>
        <span className='priceSize' style={{color:params.mineGood?'white':'#FF0000'}}>{params.price}元
        <span className='originalPriceSize' >{params.originalPrice}元</span></span>
        <span className='Detail' style={{color:params.mineGood?'white':'#DE868F'}}>{params.goodDetail}</span>
       </div>
       </div>
       {params.lowPrice==1?<div className='positionLeft'>
        <img src={knife} alt="" />
       </div>:''}
       {params.mineGood? <div className='positionRight'>
        我发布的
       </div>:''}
       
    </div>
    );
  }
  